<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{$item.subject}-EHS中国-</title>
    <link href="__TMPL__style/group-style.css" rel="stylesheet" type="text/css" />
    <load href="__PUBLIC__/Css/lwy2011.css" />
	<style>
	#dContent img{
     max-width:600px;
     /*width:600px;*/
     width:expression(this.width>590?"590px":this.width); 
     overflow:hidden;
     }
	 </style>

    <script type="text/javascript" src="__ROOT__/Public/Js/jquery-1.5.0.min.js"></script>
    <script type="text/javascript" src="__ROOT__/Public/Js/ehs.js"></script>
    <script type="text/javascript" src="__ROOT__/Public/Js/core.js"></script>
    <script>
      $.ready(function() {
        alert('a');
	   
      });
    </script>
  </head>

  <body>
    <layout name="Public:header0523" cache="0" />
    <div class="main">
      <layout name="Public:group-member-base" cache="0" />
      <div class="content">
        <div class="column_left">
          <layout name="publicl-left-header" cache="0" />
          <div class="column-cont">
            <div class="state"><strong>声明：</strong>ehs.cn专家专栏文章属专家原创内容，代表个人观点，授权于ehs.cn使用；如需转载请保留原意并注明来源：ehs.cn，作者：ehs专家－{$base['username']}，请尊重原创！</div>
            <div class="column-cont-text">
              <dl>
                <dt><h3><a href="#">{$item['subject']}</a></h3></dt>
                <dd class="publish-time">发表于：<?=date('Y-m-d/H:i:s',$item['postdate'])?></dd>
                <dd>
                  <div class="btn_tj" id="d_{$item['did']}" onclick="setPromote('d',{$item['did']})" style="cursor:pointer">{$item['recommend_num']}<span>已推荐</span></div>
                  <p id="dContent"><img src="__ROOT__/Public/Images/loading.gif" /></p>
                </dd>
                <dd class="reprint-addr">本文属于自创作品，转载请说明出处。</dd>
                <dd class="column-cont-bottom"><a href="__URL__/diaryView/uid/{$uid}/did/{$item['did']}">阅读</a>({$item.r_num}) |<a href="__URL__/diaryView/uid/{$uid}/did/{$item['did']}">评论</a>(<span id="c_{$item['did']}">{$item.c_num}</span>)</dd>
              </dl>
              <div class="column-comment">
                <h4><a name="comment">发表评论</a></h4>
                <div class="column-cont-comm" id="loadImg">
                  <img src="__ROOT__/Public/Images/loading.gif" />
                </div>
                <div class="yahoo" id="pNav"></div>
                <div class="column-comm-box">
                  <form id="frm" action="__URL__/commentSave/uid/{$uid}" method="post">
                    <textarea id="txtContent" name="content" cols="80" rows="8" style="width:650px;height:180px; font-size:14px;margin-bottom:10px">既然来了，留个记号吧~</textarea>
                    <script charset="utf-8" src="/main/PublicFunction/Tpl/default/js/editor/kindeditor.js"></script>
                    <input type="button" value="发表回复" onclick="return clickComment()"/>
                    <input name="uid" value="{$item.uid}" id="uid" type="hidden"/>
                    <input name="username" value="{$item.username}" type="hidden"/>
                    <input name="type" value="diary" type="hidden"/>
                    <input name="did" id="did" value="{$item.did}" type="hidden"/>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
        <layout name="public-right" cache="0" />
        <div class="clear"></div>
      </div>
      <div class="footer">
        <layout name="Public:footer" cache="0" /></div>
    </div>
    </div>
    <script>
      var doneList=new Array();
      function setPromote(type,id){
        var doneFlag=false;
        for(var i=0; i<doneList.length ;++i){
          if(doneList[i]==type+'_'+id){
            doneFlag=true;
            break;
          }
        }
        if(!doneFlag){
          //document.write('__URL__/setPromoteAjax/type/'+type+'/uid/'+{$uid}+'/id/'+id);
          $.getJSON('__URL__/setPromoteAjax/type/'+type+'/isAjax/1/id/'+id,
          function(data){
            var num=parseInt(data.result);
            if(num>0){
              $('#'+type+'_'+id).html(num+"<span>已推荐</span>");
              doneList.push(type+'_'+id);
              alert('推荐成功');
            }
          }
        );
        }else{alert('您已经推荐过该文章了');}
      }
	  
      KE.init({
        id : 'txtContent',
        items:['emoticons'],
        resizeMode:1
      });
      KE.create('txtContent');
	   
      KE.event.add(KE.g['txtContent'].iframeDoc, 'click',cText,'txtContent');
      KE.event.add(KE.g['txtContent'].iframeDoc, 'blur',sText,'txtContent');
	 
	 
      function cText(){
        if(KE.text('txtContent')=='既然来了，留个记号吧~')
          KE.text('txtContent','');
        //alert('ha');
      }
      function sText(){
        if(KE.text('txtContent')=='')
          KE.text('txtContent','既然来了，留个记号吧~');
      }
		
	  
      function clickComment(){
        if ($("#txtContent").val() == "") {
          alert("回复内容不能为空");
          return ;
        }
        ajax.sendForm('frm',function(data){
		  if(data.status!=null && data.status==0){
		    alert(data.info);
		  }else{
          if(data.r!='0'){
            alert('评论成功');
            KE.text("txtContent",'');
            $('#c_{$item['did']}').html(data.r);
            jumpTo(1);
          }
		  }
        }
      );
        return false;
      }
	  
      function delColony(id){
        if(confirm('确定删除该评论？')){
          $.getJSON(
          '__URL__/delColonyAjax/id/'+id+'/uid/'+$('#uid').val(),
          function(data){
            if(data.r!='0'){
              $('#c_{$item['did']}').html(data.r);
              jumpTo(1);
            }
          }
        );
        }
        return false;
      }
	  
      function jumpTo(page){
        $('#loadImg').html('<img src="__ROOT__/Public/Images/loading.gif" />');
        $.ajax({
          'url':'__URL__/getCommentAjax',
          'data':{
            'uid':$('#uid').val(),
            'id':$('#did').val(),
            'p':page
          },
          'type':'POST',
          'success':function(data){
            $('#loadImg').html(data);
            var html=__foot.html(page,5,parseInt($('#c_{$item['did']}').html()),jumpTo);
            $('#pNav').html(html);
          },
          'dataType':'html'
        });
      }
	  
      //加载文章内容
	   var agt = navigator.userAgent.toLowerCase();
       var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	   window.getObj?0:getObj=function(s){return document.getElementById(s)};
	   function IsElement(id) {
	     return document.getElementById(id) != null ? true : false;
      }
      $.post(
      '/pw8/apps.php?q=diary&a=detail&fromAjax=1&type=1&uid={$uid}&did='+$('#did').val(),
      function(data){
	     data=data.replace("images","/pw8/images");
		 data=data.replace("js/player.js",'/pw8/js/player.js');
        $('#dContent').html(data);
      },
      'html'
    );
	  
      jumpTo(1);//加载评论
	  
      //alert(html);
    </script>
  </body>
</html>
